package com.smart.client.common;

import com.alibaba.fastjson.JSON;
import com.smart.client.mems.MemsResult;

/**
 * Created By Li Jiaxi
 * <br/>Date: 2023/4/15 10:17
 * <br/>Description:
 */
public class JSONTest {

    // 雷视
    static final String RaySightStr = "[\n" +
            "  {\n" +
            "    \"tblType\": \"tbl_result_flow_volume_measurement_info\", \n" +
            "    \"version\": \"1.0.0\", \n" +
            "    \"stationCode\": \"00004\", \n" +
            "    \"data\": [\n" +
            "      {\n" +
            "        \"date\": \"2022-09-17\",\n" +
            "        \"time\": \"16:15:14\", \n" +
            "        \"waterStage\": 1639.23, \n" +
            "        \"maxDepth\": 0.650024, \n" +
            "        \"surfaceWidth\": 20.5, \n" +
            "        \"dischargeArea\": 8.49056, \n" +
            "        \"avgVelocity\": 0.85199, \n" +
            "        \"maxSurfaceVelocity\": 1.36773,\n" +
            "        \"radarVelocity\": 2.072, \n" +
            "        \"rvRealFlowDischarge\": 6.82242\n" +
            "      }\n" +
            "    ]\n" +
            "  },\n" +
            "  {\n" +
            "    \"tblType\": \"tbl_result_velocity_measurement_info\", \n" +
            "    \"version\": \"1.0.0\", \n" +
            "    \"stationCode\": \"00004\",\n" +
            "    \"data\": [\n" +
            "      {\n" +
            "        \"date\": \"2022-09-17\", \n" +
            "        \"time\": \"16:15:14\", \n" +
            "        \"serialNumber\": 1, \n" +
            "        \"distance\": 3.00188, \n" +
            "        \"velocity\": 0.843683,\n" +
            "        \"depthToWater\": 0.650024\n" +
            "      }\n" +
            "    ]\n" +
            "  }\n" +
            "]\n";

    // mems
    static final String memsStr = "{\n" +
            "\"topic\": \"dataReportTopic\",\n" +
            "\"stationCode\": \"ST_001\",\n" +
            "    \"message\": {\n" +
            "        \"stationCode\": \"ST_001\",\n" +
            "        \"groupCode\": \"G_001\",\n" +
            "        \"memsCode\": \"001\",\n" +
            "        \"angleX\": \"10\",\n" +
            "        \"angleY\": \"20\",\n" +
            "        \"angleZ\": \"30\",\n" +
            "        \"reportTime\": \"2022-12-07 16:00:00\"    \n" +
            "}\n" +
            "}\n";

    // 水位、雨量
    static final String rainWaterStr = "{\n" +
            "    \"qos\": 1,\n" +
            "    \"retained\": false,\n" +
            "    \"topic\": \"monitorDataTopic\",\n" +
            "    \"message\": [\n" +
            "        {\n" +
            "            \"stcd\": \"80118000\",\n" +
            "            \"paId\": \"123456789\",\n" +
            "            \"meaTime\": \"2022-05-13 00:00:00\",\n" +
            "            \"prcp\": \"1\",\n" +
            "            \"walvl\": \"1\"\n" +
            "        },\n" +
            "        {\n" +
            "            \"stcd\": \"80118000\",\n" +
            "            \"paId\": \"123456710\",\n" +
            "            \"meaTime\": \"2022-05-14 00:00:00\",\n" +
            "            \"prcp\": \"1\",\n" +
            "            \"walvl\": \"1\"\n" +
            "        }\n" +
            "    ]\n" +
            "}\n";

    public static void main(String[] args) {
        // List<RaysightResult> raysightResults = JSON.parseArray(RaySightStr, RaysightResult.class);
        // System.out.println(raysightResults);
        // RainWaterResult rainWaterResult = JSON.parseObject(rainWaterStr, RainWaterResult.class);
        // System.out.println(rainWaterResult);
        MemsResult memsResult = JSON.parseObject(memsStr, MemsResult.class);
        System.out.println(memsResult);
    }
}
